const os = require('os')
const path = require('path')

// 配置文件路径
const CONFIG_FILE = path.join(os.homedir(), '.ccapi-config.json')

// Claude settings.json中的环境变量键名
const CLAUDE_ENV_KEYS = {
  url: 'ANTHROPIC_BASE_URL',
  key: 'ANTHROPIC_API_KEY',
  token: 'ANTHROPIC_AUTH_TOKEN',
  model: 'ANTHROPIC_MODEL',
  fast: 'ANTHROPIC_SMALL_FAST_MODEL',
  timeout: 'API_TIMEOUT_MS',
  tokens: 'CLAUDE_CODE_MAX_OUTPUT_TOKENS',
  http: 'HTTP_PROXY',
  https: 'HTTPS_PROXY'
}

// 环境变量配置
const CONFIG_IDENTIFIER = 'CCAPI_CURRENT_CONFIG'

// 注意：错误和成功消息现在使用 i18n 系统管理
// 这里保留错误键名供兼容性使用
const ERROR_KEYS = {
  CONFIG_NOT_FOUND: 'errors.CONFIG_NOT_FOUND',
  SETTINGS_NOT_FOUND: 'errors.SETTINGS_NOT_FOUND',
  API_CONFIG_NOT_FOUND: 'errors.API_CONFIG_NOT_FOUND',
  INVALID_JSON: 'errors.INVALID_JSON',
  INVALID_YAML: 'errors.INVALID_YAML',
  INVALID_TOML: 'errors.INVALID_TOML',
  CONFIG_NAME_NOT_FOUND: 'errors.CONFIG_NAME_NOT_FOUND',
  SAME_CONFIG: 'errors.SAME_CONFIG',
  BACKUP_FAILED: 'errors.BACKUP_FAILED',
  ENV_SET_FAILED: 'errors.ENV_SET_FAILED',
  ENV_CLEAR_FAILED: 'errors.ENV_CLEAR_FAILED',
  PERMISSION_DENIED: 'errors.PERMISSION_DENIED',
  ENV_NOT_FOUND: 'errors.ENV_NOT_FOUND',
  PLATFORM_NOT_SUPPORTED: 'errors.PLATFORM_NOT_SUPPORTED'
}

const SUCCESS_KEYS = {
  CONFIG_SAVED: 'success.CONFIG_SAVED',
  CONFIG_SWITCHED: 'success.CONFIG_SWITCHED',
  RESTART_TERMINAL: 'success.RESTART_TERMINAL',
  BACKUP_CREATED: 'success.BACKUP_CREATED',
  ENV_SET_SUCCESS: 'success.ENV_SET_SUCCESS',
  ENV_CLEAR_SUCCESS: 'success.ENV_CLEAR_SUCCESS',
  FULL_CLEAR_SUCCESS: 'success.FULL_CLEAR_SUCCESS',
  ENV_SYNC_SUCCESS: 'success.ENV_SYNC_SUCCESS'
}

// 为了向后兼容，保留原有的对象名称
const ERROR_MESSAGES = ERROR_KEYS
const SUCCESS_MESSAGES = SUCCESS_KEYS

module.exports = {
  CONFIG_FILE,
  CLAUDE_ENV_KEYS,
  CONFIG_IDENTIFIER,
  ERROR_MESSAGES,
  SUCCESS_MESSAGES
}
